package com.liu.keeppwd;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;

public class SysState {
	public static String mainKey;
	public static String loginKey;
	private static float density = 0;

	public static int dp2pix(Context con, int dp) {
		if (density <= 0) {
			if (con instanceof Activity) {
				DisplayMetrics dm = new DisplayMetrics();
				((Activity) con).getWindowManager().getDefaultDisplay()
						.getMetrics(dm);
				density = dm.density;
			} else {
				return (int) (((float) dp) * 1.2);
			}
		}
		return (int) (((float) dp) * density);
	}

	public static int getPwidth(Activity con) {
		DisplayMetrics dm = new DisplayMetrics();
		con.getWindowManager().getDefaultDisplay().getMetrics(dm);
		return dm.widthPixels;
	}

	public static int getPheight(Activity con) {
		DisplayMetrics dm = new DisplayMetrics();
		con.getWindowManager().getDefaultDisplay().getMetrics(dm);
		return dm.heightPixels;
	}

	public static int getAndroidSDKVersion() {
		return android.os.Build.VERSION.SDK_INT;
	}

}
